/*
 * @Description:
 * @Version: 2.0
 * @Autor: snzo.chen
 * @Date: 2023-11-20 14:15:52
 * @LastEditors: snzo.chen
 * @LastEditTime: 2023-12-14 09:25:31
 */
import { BaseResponse, request, Response } from '@/utils/request';

/**
 * 查询所有票菜单
 * @param params
 * @returns
 */
export function selectAllCertificate(params: API.PageParams) {
  return request<API.SeachResult<API.CertificateItem[]>>(
    {
      url: '/personCertificate/selectAll',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 添加票菜单
 * @param data
 * @returns
 */
export function insertPersonCertificate(data: API.CertificateItem) {
  return request<Response>(
    {
      url: '/personCertificate/insertPersonCertificate',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 根据ID 查询票菜单详情
 * @param params
 * @returns
 */
export function selectCerfiticateById(params: API.CertificateItem) {
  return request<BaseResponse<any>>(
    {
      url: '/personCertificate/selectById',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 根据ID and cerName 查询证书
 * @param params
 * @returns
 */
export function GetOneCer(params: API.CertificateItem) {
  return request<BaseResponse<any>>(
    {
      url: '/personCertificate/GetOneCer',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 按条件查询
 * @param params
 * @returns
 */
export function selectCertificateByExample(data: API.CertificateItem, params: API.PageParams) {
  return request<BaseResponse<any>>(
    {
      url: '/personCertificate/selectByExample',
      method: 'post',
      data,
      params,
    },
    {
      isGetDataDirectly: true,
    },
  );
}

/**
 * 更新票带单
 * @param data
 * @returns
 */
export function updatePersonCertificate(data: API.CertificateItem) {
  return request<API.BaseResult>(
    {
      url: '/personCertificate/updatePersonCertificate',
      method: 'post',
      data,
    },
    {
      isGetDataDirectly: false,
    },
  );
}

/**
 * 根据ID删除票菜单
 * @param data
 * @returns
 */
export function deletePersonCertificate(params: API.CertificateItem) {
  return request<API.BaseResult>(
    {
      url: '/personCertificate/deletePersonCertificate',
      method: 'get',
      params,
    },
    {
      isGetDataDirectly: false,
    },
  );
}
